﻿
-- --------------------------------------------------------------------------------------------------------
-- [Application] generated on 12/02/2012 07:42:23 by SdlcSchema.tt
-- --------------------------------------------------------------------------------------------------------
CREATE TABLE dbo.Application (
	ApplicationId	Int NOT NULL
	, ApplicationName	Char(25) NOT NULL
	, ApplicationType	Char(02) NOT NULL
	, ApplicationAltPk	uniqueidentifier NOT NULL CONSTRAINT dfltApplicationAltPk DEFAULT newid()
	, ApplicationAdded	datetime NOT NULL CONSTRAINT dfltApplicationAdded DEFAULT getdate()
	, ApplicationUpdated	datetime 
	, ApplicationVersion	timestamp NOT NULL
	CONSTRAINT Application_pk PRIMARY KEY CLUSTERED 
	(
		ApplicationId ASC
	) 
	WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) ON [PRIMARY]
) ON [PRIMARY]
			
CREATE UNIQUE NONCLUSTERED INDEX Application_UX ON dbo.Application ( ApplicationAltPk ASC )
WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,SORT_IN_TEMPDB=OFF,IGNORE_DUP_KEY=OFF,DROP_EXISTING=OFF,ONLINE=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) 
ON [PRIMARY]

-- --------------------------------------------------------------------------------------------------------
-- [Release] generated on 12/02/2012 07:42:23 by SdlcSchema.tt
-- --------------------------------------------------------------------------------------------------------
CREATE TABLE dbo.Release (
	ApplicationId	Int NOT NULL
	, ReleaseSeq	Int NOT NULL
	, ReleaseName	Char(25) NOT NULL
	, ReleaseAltPk	uniqueidentifier NOT NULL CONSTRAINT dfltReleaseAltPk DEFAULT newid()
	, ReleaseAdded	datetime NOT NULL CONSTRAINT dfltReleaseAdded DEFAULT getdate()
	, ReleaseUpdated	datetime 
	, ReleaseVersion	timestamp NOT NULL
	CONSTRAINT Release_pk PRIMARY KEY CLUSTERED 
	(
		ApplicationId ASC, ReleaseSeq ASC
	) 
	WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) ON [PRIMARY]
) ON [PRIMARY]
			
CREATE UNIQUE NONCLUSTERED INDEX Release_UX ON dbo.Release ( ReleaseAltPk ASC )
WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,SORT_IN_TEMPDB=OFF,IGNORE_DUP_KEY=OFF,DROP_EXISTING=OFF,ONLINE=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) 
ON [PRIMARY]

ALTER TABLE dbo.Release  WITH CHECK ADD  CONSTRAINT Release_Application_FK FOREIGN KEY
(
	HelloDaveId
) 
REFERENCES dbo.Application (ApplicationId)	

-- --------------------------------------------------------------------------------------------------------
-- [Iteration] generated on 12/02/2012 07:42:23 by SdlcSchema.tt
-- --------------------------------------------------------------------------------------------------------
CREATE TABLE dbo.Iteration (
	ApplicationId	Int NOT NULL
	, ReleaseSeq	Int NOT NULL
	, IterationSeq	Int NOT NULL
	, IterationBegin	datetime NOT NULL
	, IterationAltPk	uniqueidentifier NOT NULL CONSTRAINT dfltIterationAltPk DEFAULT newid()
	, IterationAdded	datetime NOT NULL CONSTRAINT dfltIterationAdded DEFAULT getdate()
	, IterationUpdated	datetime 
	, IterationVersion	timestamp NOT NULL
	CONSTRAINT Iteration_pk PRIMARY KEY CLUSTERED 
	(
		ApplicationId ASC, ReleaseSeq ASC, IterationSeq ASC
	) 
	WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,IGNORE_DUP_KEY=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) ON [PRIMARY]
) ON [PRIMARY]
			
CREATE UNIQUE NONCLUSTERED INDEX Iteration_UX ON dbo.Iteration ( IterationAltPk ASC )
WITH (PAD_INDEX=OFF,STATISTICS_NORECOMPUTE=OFF,SORT_IN_TEMPDB=OFF,IGNORE_DUP_KEY=OFF,DROP_EXISTING=OFF,ONLINE=OFF,ALLOW_ROW_LOCKS=ON,ALLOW_PAGE_LOCKS=ON) 
ON [PRIMARY]

ALTER TABLE dbo.Iteration  WITH CHECK ADD  CONSTRAINT Iteration_Release_FK FOREIGN KEY
(
	Release
) 
REFERENCES dbo.Release (ApplicationId,ReleaseSeq)	
